CMakePackage: Add option to get cmake args from dependencies#3197
CMakePackage: Add option to get cmake args from dependencies#3197alalazo merged 6 commits intospack:developfrom
Conversation
537c68e to
a3352ca
Compare
This feature is not complete but it is a minimal implementation to provided the ability for packages to define hints for cmake. Not all hints can be passed as environment variables and cmake argument injection is not possible via existing mechanisms. As a demonstration of this feature the python hint flags are converted from the ad hoc method in the CMakePackage to using the package callback. Flags can be disabled using a common class list attribute `disable_cmake_hints_from`.
a3352ca to
d2f9c7a
Compare
|
Still don't love that it's opt-out instead of opt-in, but I understand why (warnings harm no one, and fixes help everyone). I agree it makes more sense to move this into the Python package. |
|
What I don't like about this conceptually is that the python package imports the cmake module. Once we do content hashing properly and follow imports, it would mean that Python's hash is affected by changes to the Secondly, you've put this under |
alalazo
left a comment
There was a problem hiding this comment.
I have a few comments on the code, on top of the python-venv vs. python issue Harmen pointed out.1
Sorry to be pickier than for other PRs, but this is going to be triggered most of the times and is in a code path that is difficult to remove after we merge the PR.
Footnotes
-
The
cmdefineissue can be solved by not using the convenience function imo. ↩
So what is the correct behavior here? I would think that |
|
@haampie are you okay if we just put a comment next to the python setup that says something along the lines of |
Remove cruft from virtual handling remove CMakePackge dep add comment about python-venv redirect
957e92b to
a29a912
Compare
Sure, but it's very confusing to use That tells me that Maybe you could write it as class Python:
def dependent_cmake_args(self, dependent_spec: Spec) -> List[str]:
if dependent_spec.dependencies("python-venv"):
return []
return [... self.command ...]
...
class PythonVenv:
def dependent_cmake_args(self, dependent_spec: Spec) -> List[str]:
return [... self.command ...]but that's also not satisfactory cause packages would have to opt out of two packages that provide hints instead of one. |
2f6ba6d to
7ec37e6
Compare
7ec37e6 to
6cb4746
Compare
I disagree on a couple points here. Personally I don't think it is that confusing. It is reasonably well documented at this point that python has some special handling already and the comment links to the PR that has additional details about why this is the case. I spent a couple of seconds reading the PR and understood what was done well enough to understand why it was written that way. We could also write it is I really don't like package specific code inside of the |
2076012 to
1a954af
Compare
haampie
left a comment
There was a problem hiding this comment.
Still not a convinced that python is currently the best example given the interaction with python-venv, but I can live with it. Few small requests.
1bda1db to
7b7a551
Compare
|
@spackbot run pipeline |
|
I've started that pipeline for you! |
|
Yeah, I'll go on force merging this - there are just a handful of known flaky jobs that went ❌ |
This feature is not complete but it is a minimal implementation to provided the ability for packages to define hints for cmake. Not all hints can be passed as environment variables and cmake argument injection is not possible via existing mechanisms.
As a demonstration of this feature the python hint flags are converted from the ad hoc method in the CMakePackage to using the package callback.
Flags can be disabled using a common class list attribute
disable_cmake_hints_from.Extracted from #2057